
#include "item.h"

#include <attest/attest.h>

#define PUP_ITEM_TEST(type, var, value) \
        ATTEST(item, type) { \
          pup_item_t item = pup_item_##type(value); \
          ATTEST_EQ(value, item.var); \
        }

static int foo = 2;

ATTEST(item, size_of_item)
{
  ATTEST_EQ(8, sizeof(pup_item_t));
}

PUP_ITEM_TEST(char, c, 'X')
PUP_ITEM_TEST(double, d, 1234.567)
PUP_ITEM_TEST(float, f, -123)
PUP_ITEM_TEST(int, i, 897234);
PUP_ITEM_TEST(int8, i8, -23);
PUP_ITEM_TEST(int16, i16, 24583);
PUP_ITEM_TEST(int32, i32, -12398752);
PUP_ITEM_TEST(int64, i64, 8879287394872);
PUP_ITEM_TEST(long, l, -87234);
PUP_ITEM_TEST(longlong, ll, 23489725);
PUP_ITEM_TEST(short, s, -24895);
PUP_ITEM_TEST(sizet, szt, 9887234);
PUP_ITEM_TEST(uint, u, 4235);
PUP_ITEM_TEST(uchar, uc, 98);
PUP_ITEM_TEST(ulong, ul, 98797234);
PUP_ITEM_TEST(ulonglong, ull, 52987987234);
PUP_ITEM_TEST(ushort, us, 56829);
PUP_ITEM_TEST(uint8, u8, 234);
PUP_ITEM_TEST(uint16, u16, 60923);
PUP_ITEM_TEST(uint32, u32, 3239874897);
PUP_ITEM_TEST(uint64, u64, 8987989287340109);
PUP_ITEM_TEST(ptr, ptr, &foo);

